package com.yurun.service.impl;

import com.yurun.entity.VisitRecord;
import com.yurun.exception.PersistenceException;
import com.yurun.mapper.VisitRecordMapper;
import com.yurun.service.VisitRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VisitRecordServiceImpl implements VisitRecordService {
    @Autowired
    VisitRecordMapper visitRecordMapper;

    @Override
    public void addVisitRecord(VisitRecord visitRecord){
        if(visitRecordMapper.addVisitRecord(visitRecord)!=1){
            throw new PersistenceException("添加访问记录失败");
        }
    }

    @Override
    public List<VisitRecord> getVisitRecordListByLimit(Integer limit){
        return visitRecordMapper.getVisitRecordListByLimit(limit);
    }
}
